#include "AutoExplorBotDialog.h"
#include "ExplorBotLibrary.h"

#include <QIcon>
#include <QPushButton>
#include <QFile>
#include <QLabel>
#include <QHBoxLayout>
#include <QCheckBox>

AutoExplorBotDialog::AutoExplorBotDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	init();
}

AutoExplorBotDialog::~AutoExplorBotDialog()
{

}

void AutoExplorBotDialog::init()
{
	QIcon boticon("images/bot.png");
	QPushButton* botbt = new QPushButton();
	botbt->setIcon(boticon);
	botbt->setIconSize(QSize(560,380));
	botbt->setFlat(true);
	ui.verticalLayout->addWidget(botbt);

	QLabel* textLabel  = new QLabel;
	textLabel  -> setText("<font size= 52 color=white><b>Auto Apply Last ExploreBot? </b></font>");
	ui.verticalLayout->addWidget(textLabel);
	

	QHBoxLayout* oklayout = new QHBoxLayout;
	autoshow = new QCheckBox;
	autoshow->setText("Dont Show Next Time");
	QPalette plt;
	plt.setColor(QPalette::WindowText, Qt::white);
	autoshow->setPalette(plt);

	oklayout->addWidget(autoshow);

	QIcon okicon("images/check.png");
	okButton = new QPushButton();
	okButton->setIcon(okicon);
	okButton->setIconSize(QSize(50,50));
	okButton->setFlat(true);
	oklayout->addWidget(okButton);

	QIcon calcelicon("images/cancel2.png");
	cancelButton = new QPushButton();
	cancelButton ->setIcon(calcelicon);
	cancelButton ->setIconSize(QSize(50,50));
	cancelButton ->setFlat(true);
	oklayout->addWidget(cancelButton);

	ui.verticalLayout->addLayout(oklayout);

	connect(okButton,SIGNAL(clicked()),this,SLOT(okpress()));
	connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelpress()));


}

void AutoExplorBotDialog::setStyle()
{
	QFile* cssFile = new QFile("style.css");
//	assert(cssFile);
	cssFile->open(QFile::ReadOnly);
	this->setStyleSheet(cssFile->readAll());
	cssFile->close();
	delete cssFile;

}

void AutoExplorBotDialog::okpress()
{

}
void AutoExplorBotDialog::cancelpress()
{
	ExplorBotLibrary::getInstance()->clearList();
	this->close();
}